import React, { Component } from "react";
import { Icon } from "antd-mobile";
import "./BillTableCell.scss";

/**
 * 账单item
 */
export class BillTableCell extends Component {
	//头部标题

	constructor(props) {
		super(props);
		this.state = {
			tabIndex: 0
		};
	}

	/*
	 * 点击事件
	 */
	cellSelect() {
		this.props.cellSelectCallback(this.props.cellData);
	}

	render() {
		let cellData = this.props.cellData;
		return (
			<div className="bill-table-cell" onClick={this.cellSelect.bind(this)}>
				<div className="cell-left">
					<div className="c-text">
						{cellData.type == "0" ? "" : "退款-"}
						{cellData.storeName}
					</div>
					<div className="c-detail">{cellData.tradeDate}</div>
				</div>
				<div className="cell-right">
					<div className={cellData.type == "0" ? "r-amount" : "r-amount red"}>
						{cellData.type == "0" ? "" : "-"}
						{cellData.tradeAmount}元
					</div>
					<div className="r-arrow">
						<Icon type="right"></Icon>
					</div>
				</div>
			</div>
		);
	}
}
